package com.wdd.web.test01.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wdd.web.test01.dao.UserMapperTest01;
import com.wdd.web.test02.dao.UserMapperTest02;
@Service
public class UserServiceTest01 {
	@Autowired
	private UserMapperTest01 userMapperTest01;
	@Autowired
	private UserMapperTest02 userMapperTest02;
	/**
	 * 测试事物
	 * @param id
	 * @param name
	 */
	@Transactional
	public void insertTest01(String id,String name){
		userMapperTest01.createUser(id, name);
		userMapperTest02.createUser(id, name);
//		System.out.println(1/0);//测试多数据源事物 回滚
	}
	@Async
	public void testAsync(){
		System.out.println("+===+2");
	}
}
